package com.me.modules.sla.service.impl;

import com.me.modules.common.common.Constant;
import com.me.modules.common.page.Page;
import com.me.modules.common.page.PageHelper;
import com.me.modules.common.utils.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.me.modules.sla.dao.SlaLevelDao;
import com.me.modules.sla.entity.SlaLevelEntity;
import com.me.modules.sla.service.SlaLevelService;



@Service
public class SlaLevelServiceImpl implements SlaLevelService {
	@Autowired
	private SlaLevelDao slaLevelDao;

	@Override
	public SlaLevelEntity queryObject(Long id){
		return slaLevelDao.queryObject(id);
	}

	@Override
	public List<SlaLevelEntity> queryList(Map<String, Object> map){
		return slaLevelDao.queryList(map);
	}

    @Override
    public List<SlaLevelEntity> queryListByBean(SlaLevelEntity entity) {
        return slaLevelDao.queryListByBean(entity);
    }

	@Override
	public int queryTotal(Map<String, Object> map){
		return slaLevelDao.queryTotal(map);
	}

	@Override
	public int save(SlaLevelEntity slaLevel){
		slaLevel.setCreateDate(new Date());
		slaLevel.setCreateUser(UserUtils.getCurrentUser().getLoginName());
		return slaLevelDao.save(slaLevel);
	}

	@Override
	public int update(SlaLevelEntity slaLevel){
		slaLevel.setUpdateDate(new Date());
		slaLevel.setUpdateUser(UserUtils.getCurrentUser().getLoginName());
		return slaLevelDao.update(slaLevel);
	}

	@Override
	public int delete(Long id){
        return slaLevelDao.delete(id);
	}

	@Override
	public int deleteBatch(Long[] ids){
        return slaLevelDao.deleteBatch(ids);
	}


	@Override
	public Page<SlaLevelEntity> findPage(SlaLevelEntity slaLevel, int pageNum) {
		PageHelper.startPage(pageNum, Constant.pageSize);
		slaLevelDao.queryList(slaLevel);
		return PageHelper.endPage();
	}
}
